﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

using Gronia.WPF;
using Gronia.WPF.Controls;

using System.Windows.Threading;
namespace Gronia.Test
{
    public partial class CustomWindowTest : CustomWindow
    {
        public CustomWindowTest()
        {
            InitializeComponent();
            Loaded += delegate
            {
                BusyIndicator.BusyImageType = BusyImageType.GIF;
                BusyIndicator.BusyImage = new BitmapImage(new Uri("pack://application:,,,/Gronia.Test;component/Image/loading.gif", UriKind.RelativeOrAbsolute));
                BusyIndicator.BusyLoadingImageType = BusyLoadingImageType.GIF;
                BusyIndicator.BusyLoadingImage = new BitmapImage(new Uri("pack://application:,,,/Gronia.Test;component/Image/loading2.gif", UriKind.RelativeOrAbsolute));
                BusyIndicator.BusyContent = "Dosya indiriliyor...";
            };
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void Button_Click2(object sender, RoutedEventArgs e)
        {
            // Siz dosyayı indirirsiniz ben 3 saniye bekletip geri açacağım.
            IsBusy = true;
            DispatcherTimer timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromSeconds(3);
            timer.Tick += delegate
            {
                IsBusy = false;
                timer.Stop();
            };
            timer.Start();
        }
    }
}
